import request from '@/utils/request'

// 查询保养项目列表
export function listMaintenanceItem(query) {
  return request({
    url: '/ldzl-sb/sb/maintenance/item/list',
    method: 'get',
    params: query
  })
}

// 查询保养项目详细
export function getMaintenanceItem(itemId) {
  return request({
    url: '/ldzl-sb/sb/maintenance/item/' + itemId,
    method: 'get'
  })
}

// 新增保养项目
export function addMaintenanceItem(data) {
  return request({
    url: '/ldzl-sb/sb/maintenance/item',
    method: 'post',
    data: data
  })
}

// 修改保养项目
export function updateMaintenanceItem(data) {
  return request({
    url: '/ldzl-sb/sb/maintenance/item',
    method: 'put',
    data: data
  })
}

// 删除保养项目
export function delMaintenanceItem(itemId) {
  return request({
    url: '/ldzl-sb/sb/maintenance/item/' + itemId,
    method: 'delete'
  })
}

// 根据配置ID获取保养项目列表
export function getItemsByConfigId(configId) {
  return request({
    url: '/ldzl-sb/sb/maintenance/item/list/' + configId,
    method: 'get'
  })
}

// 批量保存保养项目
export function batchSaveMaintenanceItems(configId, items, username) {
  return request({
    url: '/ldzl-sb/sb/maintenance/item/batchSave/' + configId + '?username=' + username,
    method: 'post',
    data: items
  })
} 